﻿@model IEnumerable<Gfw.Web.Models.Account.WarrantTransferQueryModel>

@{
    Layout = null;
}

@using C.Mvc
@using MvcContrib.UI.Grid;

@using (Ajax.BeginForm("WarrantTransferQueryList", "UserAccount", null, Gfw.Web.Common.ViewHelper.AjaxGet))
{
    @Html.Grid(Model).Columns(
            column =>
            {
                column.For(x => x.UserLoginName).Named("转出用户");
                column.For(x => x.ToUserLoginName).Named("转入用户");
                column.For(x => x.TradeDate).Named("担保时间");
                column.For(x => x.Money).Named("金额");
                column.For(x => x.RemainDate).Named("过期时间");
                column.For(x => x.Status).Named("状态");
                column.For(x => x.TradeAbstract).Named("摘要");
                column.Custom(@<text>
        @Html.ActionLink("详情", "WarrantTransferDetail", new { userID = item.UserID, toUserID = item.ToUserID,
    tradeDate = item.TradeDate , status = item.Status, current = item.CurrentUserID })
@if(item.CurrentUserID == item.ToUserID && item.Status.Contains("担保进行中"))
{
    @: | @Html.ActionLink("已转账", "WarrantTransferHasTransfer", new { userID = item.UserID, toUserID = item.CurrentUserID,
    tradeDate = item.TradeDate, status = item.Status, current = item.CurrentUserID })
    @: | @Ajax.ActionLink("退还", "WarrantTransferReturn", new {  toSellerID = item.UserID, tradeDate = item.TradeDate }, new AjaxOptions()
           {
               UpdateTargetId = Gfw.Web.Common.ViewHelper.AjaxContainer,
               HttpMethod = "Post",
               InsertionMode = InsertionMode.Replace,
               Confirm = "确定要撤销担保交易吗？"
           })
}

@if(item.CurrentUserID == item.UserID && item.Status.Contains("已转账"))
{
    @: | @Ajax.ActionLink("已确认", "WarrantTransferAck", new { toUserID = item.ToUserID, tradeDate = item.TradeDate }, new AjaxOptions()
    {
        UpdateTargetId = Gfw.Web.Common.ViewHelper.AjaxContainer,
        HttpMethod = "Post",
        InsertionMode = InsertionMode.Replace,
        Confirm = "确认收款，完成担保交易？"
    })
}
    </text>).Named("操作");
            }).Attributes(id => "mytable", cellpadding => "0", cellspacing => "0").Empty("没有相关信息");


    @Ajax.DataGridPager().Totals(ViewBag.TotalSize).PageIndex(ViewBag.PageIndex).PagePropertyName("page").Model(new { did = ViewBag.did}).AjaxOptions(Gfw.Web.Common.ViewHelper.AjaxGet);
}